package cn.bgs.controller;

import cn.bgs.page.PageRequest;
import cn.bgs.pojo.Announcement;
import cn.bgs.service.AnnouncementsService;
import cn.bgs.utils.R;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Announcement")
public class AnnouncementsController {
    @Autowired
    private AnnouncementsService announcementsService;
    @GetMapping("/announcementSelect")
    public PageInfo<Announcement> announcementSelect(PageRequest pageRequest,String theTheme){
        PageInfo<Announcement> allUser = announcementsService.announcementSelect(pageRequest,theTheme);
        return allUser;
    }
    @PostMapping("/announcementAdd")
    public R announcementAdd(@RequestBody Announcement announcement){
        return announcementsService.announcementAdd(announcement);
    }
    @PostMapping("/announcementUpdate")
    public R announcementUpdate(@RequestBody Announcement announcement){
        return announcementsService.announcementUpdate(announcement);
    }
    @GetMapping("/announcementDelect")
    public R announcementDelect(Integer announcementId){
        return announcementsService.announcementDelect(announcementId);
    }
}
